package com.ysm.smfu.utils;

import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;

public class ViewUtils {

    /**
     * 和父view 断绝关系
     * @param view
     */
    public static  void removeFromParent(View view){
        if (view != null){
            ViewParent parent = view.getParent();
            if (parent!= null && parent instanceof ViewGroup){//instanceof类属于
                ViewGroup group = (ViewGroup) parent;
                group.removeView(view);
            }
        }
    }
}
